package com.chanyachting.emall.domain;

import java.util.List;

import com.chanyachting.emall.dao.ShortmessageDAO;
import com.chanyachting.emall.domain.base.BaseShortmessage;
import com.chanyachting.emall.util.DateUtil;

/**
 * This is the object class that relates to the shortmessage table.
 * Any customizations belong here.
 */
public class Shortmessage extends BaseShortmessage {

/*[CONSTRUCTOR MARKER BEGIN]*/
	public Shortmessage () {
		super();
	}

	/**
	 * Constructor for primary key
	 */
	public Shortmessage (java.lang.Integer _id) {
		super(_id);
	}

/*[CONSTRUCTOR MARKER END]*/
	
	
	public static List list(){

		return new ShortmessageDAO().find("from Shortmessage");
	}
	
	public static List listBySenderId(int senderId){
		
		String args[]={String.valueOf(senderId)};
		
		return new ShortmessageDAO().find("from Shortmessage where senderId=?",args);
	}
	
	
	public static List listByReaderId(int readerId){

		String args[]={String.valueOf(readerId)};
		
		return new ShortmessageDAO().find("from Shortmessage where readerId=?",args);
	}
	
	
	
	public boolean update(){
		
		new ShortmessageDAO().update(this);
		
		return true;
	}
	
	
	
	public boolean send(){
		
		new ShortmessageDAO().save(this);
		
		return true;
	}
	
	
	
	public boolean delete(){
		
		new ShortmessageDAO().delete(this);
		
		return true;
	}
	
	
}